
<div class="btn-group"><a href="<?php echo site_urlc('article/index');?>" class="btn"> <i class="fa fa-arrow-left"></i> <?php echo lang('back_list')?> </a></div>

<?php include_once 'inc_form_errors.php'; ?>

<div class="boxed">
	<h3> <i class="fa fa-pencil"></i> 编辑消息 <span class="badge badge-success pull-right"><?php echo $title; ?>-新闻管理</span></h3>
	<?php echo form_open(current_urlc(), array('class' => 'form-horizontal', 'id' => 'frm-edit')); ?>

	<div class="boxed-inner seamless">

		<div class="control-group">
			<label for="title" class="control-label">标题:</label>
			<div class="controls">
				<input type="text" name="title" id="title" value="<?php echo set_value('title',$it['title']); ?>"  placeholder="栏目名称" required=1>
				<a href="#seo-modal" role="button" class="btn btn-info" data-toggle="modal">SEO</a>
				<span class="help-inline"></span>
			</div>
		</div>

        <div class="control-group">
            <label class="control-label" for="source"> 来源 </label>
            <div class="controls">
                <input type="text" id="source" name="source" value="<?php echo set_value("source",$it['source']) ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="c_type">类型</label>
            <div class="controls">
                <select name="c_type" value="c_type" id="c_type">
                    <option value="1" <?php if($it['c_type']==1){echo 'selected';}?>>圈子</option>
                    <option value="2" <?php if($it['c_type']==2){echo 'selected';}?>>长文章</option>
                    <option value="3" <?php if($it['c_type']==3){echo 'selected';}?>>话题</option>
                    <option value="4" <?php if($it['c_type']==4){echo 'selected';}?>>个人主页</option>
                    <option value="5" <?php if($it['c_type']==5){echo 'selected';}?>>企业主页</option>
                    <option value="6" <?php if($it['c_type']==6){echo 'selected';}?>>需求详情</option>
                    <option value="7" <?php if($it['c_type']==7){echo 'selected';}?>>外链</option>
                </select>
            </div>
        </div>
        <div class="control-group" id="link">
            <label class="control-label" for="source_url"> 链接地址 </label>
            <div class="controls">
                <input type="text" id="source_url" name="source_url" value="<?php echo set_value("source_url",$it['source_url']) ?>">
            </div>
        </div>

        <div class="control-group" id="t_id">
            <label class="control-label" for="t_id"> id值</label>
            <div class="controls">
                <input type="text" class='span7' id="t_id" name="t_id" value="<?php echo set_value("t_id",$it['t_id']); ?>">
            </div>
        </div>

		<!-- 弹出 -->
		<div id="seo-modal" class="modal hide fade">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
				<h3> <i class="fa fa-info-circle"></i> SEO优化</h3>
			</div>
			<div class="modal-body seamless">

				<div class="control-group">
					<label for="title_seo" class="control-label"><?php echo lang('title_seo') ?></label>
					<div class="controls">
						<input type="text" id="title_seo" name="title_seo" value="<?php echo set_value('title_seo',$it['title_seo']) ?>" x-webkit-speech>
						<span class="help-inline"></span>
					</div>
				</div>

				<div class="control-group">
					<label class="control-label" for="tag"><?php echo lang('tag') ?></label>
					<div class="controls">
						<input type="text" id="tags" name="tags" value="<?php echo set_value('tags',$it['tags']) ?>" placeholder="tag1,tag2">
						<span class="help-inline">使用英文标点`,`隔开</span>
					</div>
				</div>

				<div class="control-group">
					<label for="intro"  class="control-label"><?php echo lang('intro') ?></label>
					<div class="controls">
						<textarea name="intro" rows='8' class='span4'><?php echo set_value('intro',$it['intro']) ?></textarea>
						<span class="help-inline"></span>
					</div>
				</div>

			</div>
			<div class="modal-footer">
				<a href="#"  data-dismiss="modal" aria-hidden="true" class="btn">Close</a>
			</div>
		</div>

		<div class="control-group uefull">
			<textarea id="content" name="content"> <?php echo set_value('content',$it['content']); ?></textarea>
		</div>

	</div>
	<div class="boxed-footer">
		<?php if ($this->ccid): ?>
			<input type="hidden" name="ccid" value="<?php echo $this->ccid ?>">
		<?php endif ?>
		<input type="hidden" name="cid" value="<?php echo $this->cid ?>">
		<input type="hidden" name="id" value="<?php echo $it['id']?>">
		<input type="submit" value="<?php echo lang('submit') ?>" class="btn btn-primary">
		<input type="reset" value="<?php echo lang('reset') ?>" class="btn btn-danger">
	</div>
</form>
</div>

<!-- 注意加载顺序 -->
<?php include_once 'inc_ui_media.php'; ?>
<script type="text/javascript">
	require(['adminer/js/ui','adminer/js/media','bootstrap-datetimepicker.zh'],function(ui,media){
		$('.timepicker').datetimepicker({'language':'zh-CN','format':'yyyy/mm/dd hh:ii:ss','todayHighlight':true});
		console.log(ui);
		ui.editor_create('content');
		media.init();

		var articles_photos = <?php echo json_encode(one_upload($it['photo'])) ?>;
		media.show(articles_photos,"photo");
        var ctype = $('#c_type option:selected').val();//选中的值
        if(ctype==7){
            $("#link").css('display','block');
            $("#t_id").css('display','none');
        }else{
            $("#link").css('display','none');
            $("#t_id").css('display','block');
        }
        $("#c_type").change(function(){
            var ctype = $('#c_type option:selected').val();//选中的值
            if(ctype==7){
                $("#link").css('display','block');
                $("#t_id").css('display','none');
            }else{
                $("#link").css('display','none');
                $("#t_id").css('display','block');
            }
        });

	});
</script>
